<?php
class halo_RandomViewHelper {
    public function randomize($input, $howMany = null)
    {
        if ( $howMany === null ) $howMany = count($input);
        $back = array();
        while ( count($back) < $howMany and count($input) )
        {
            $randomIdx = rand(0, count($input) - 1);
            $back[] = $input[$randomIdx];
            array_splice($input, $randomIdx, 1);
        }
        return $back;
    }
}
?>
